import {SET_TODO,SET_TODO_LIST,REMOVE_TODO,SET_TODO_STATUS,SET_TODO_DOING} from './actionType';
import {Commit} from 'vuex';
import {IState,ITodo} from '@/typings';
//声明类型
interface ICtx{
	commit:Commit,
	state:IState,
}

export default{
	//解构ctx出commit
	[SET_TODO]({commit}:ICtx,todo:ITodo):void{
		commit(SET_TODO,todo);
	},
	[SET_TODO_LIST]({commit}:ICtx,todoList:ITodo[]):void{
		commit(SET_TODO_LIST,todoList);
	},
	[REMOVE_TODO]({commit}:ICtx,id:number):void{
		commit(REMOVE_TODO,id);
	},
	[SET_TODO_STATUS]({commit}:ICtx,id:number):void{
		commit(SET_TODO_STATUS,id);
	},
	[SET_TODO_DOING]({commit}:ICtx,id:number):void{
		commit(SET_TODO_DOING,id);
	},
}

